cairo_restore (cr);
}
+static void
+union_with_clip (GtkWidget *widget,
+ gpointer clip)
+{
+ GtkAllocation widget_clip;
+
+ if (!gtk_widget_is_visible (widget) ||
+ !_gtk_widget_get_child_visible (widget))
+ return;
+
+ gtk_widget_get_clip (widget, &widget_clip);
+
+ gdk_rectangle_union (&widget_clip, clip, clip);
+}
+
+void
+gtk_container_get_children_clip (GtkContainer *container,
+ GtkAllocation *out_clip)
+{
+ memset (out_clip, 0, sizeof (GtkAllocation));
+
+ gtk_container_forall (container, union_with_clip, out_clip);
+}
+
/**
* gtk_container_propagate_draw:
* @container: a #GtkContainer
gboolean _gtk_container_get_border_width_set (GtkContainer *container);
void _gtk_container_set_border_width_set (GtkContainer *container,
gboolean border_width_set);
+void gtk_container_get_children_clip (GtkContainer *container,
+ GtkAllocation *out_clip);
G_END_DECLS
priv->clip = *clip;
}
-static void
-union_with_clip (GtkWidget *widget,
- gpointer clip)
-{
- GtkAllocation widget_clip;
-
- if (!gtk_widget_is_visible (widget) ||
- !_gtk_widget_get_child_visible (widget))
- return;
-
- gtk_widget_get_clip (widget, &widget_clip);
-
- gdk_rectangle_union (&widget_clip, clip, clip);
-}
-
/*
* _gtk_widget_set_simple_clip:
* @widget: a #GtkWidget
if (GTK_IS_CONTAINER (widget))
{
- if (_gtk_widget_get_has_window (widget))
- {
- clip.x -= allocation.x;
- clip.y -= allocation.y;
- }
+ GdkRectangle children_clip;
- gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip);
+ gtk_container_get_children_clip (GTK_CONTAINER (widget), &children_clip);
if (_gtk_widget_get_has_window (widget))
{
- clip.x += allocation.x;
- clip.y += allocation.y;
+ children_clip.x += allocation.x;
+ children_clip.y += allocation.y;
}
+
+ gdk_rectangle_union (&children_clip, &clip, &clip);
}
gtk_widget_set_clip (widget, &clip);